<?php

namespace App\Http\Controllers\Web\Seller;

use App\ConstDir\ErrorConst;
use App\Http\Controllers\Web\BaseController;
use App\Repository\Repositories\Interfaces\ItemsStockRepository;
use Illuminate\Http\Request;

/**
 *
 * 卖家配单产品管理
 * @package App\Http\Controllers\Backend
 */
class ItemsStockController extends BaseController
{
    protected $itemstock;
    protected $request;
    protected $sp_uid;

    public function __construct(ItemsStockRepository $itemstock,Request $request)
    {
        parent::__construct();
        $this->request=$request;
        $this->itemstock=$itemstock;
        $this->sp_uid =array_get($this->user, 'id');
//        //用户只能操作自身所属数据
        $this->itemstock->scopeQuery(function ($query) {
            return $query->where('seller_id',$this->sp_uid);
        });
    }

    public function index()
    {
        $itemstock = $this->itemstock->all(['id','product_name','brand','model','price']);

        return $this->success(ErrorConst::SUCCESS_CODE_MSG, $itemstock['data'], false);
    }



}
